package com.example.shop_2207.adapter

import android.widget.CheckBox
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.shop_2207.R
import com.example.shop_2207.entity.CarEntity
import com.example.shop_2207.net.GlideUtils

class CarAdapter(list: MutableList<CarEntity>):BaseQuickAdapter<CarEntity,BaseViewHolder>(R.layout.item_car,list) {
    override fun convert(holder: BaseViewHolder, item: CarEntity) {
        holder.setText(R.id.tv_desc,item.goods_desc)
        holder.setText(R.id.tv_price,"${item.goods_default_price}元/个")
        holder.setText(R.id.tv_total,"合计：${item.goods_default_price*item.count}元")
        holder.setText(R.id.tv_num,"${item.count}")
        GlideUtils.loadImage(context,item.goods_default_icon,holder.getView(R.id.iv_icon))
        holder.getView<CheckBox>(R.id.cb).isChecked = item.isCheck
    }
}